from flask import Flask, Blueprint, request
import sys
from admin import admin
from user import user


# 为什么将蓝图与Flask对象放在一个模块下，不能被添加进url_map或者说不能被映射
# user = Blueprint('user', __name__)
#
# admin = Blueprint('admin', __name__)

app = Flask(__name__)

app.register_blueprint(admin)

app.register_blueprint(user)


@admin.route("/admin/hello")
def hello():
    return "/admin/hello"


@user.route("/user/hello")
def hello():
    return "/user/hello"


@app.route("/")
def index():
    return "index"


if __name__ == '__main__':
    print(__name__)
    print(sys.modules.get(__name__))
    print(app.url_map)
    print(__file__)
    app.run(port=80, debug=True, host="0.0.0.0")
